package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 收货
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_receive")
@ApiModel(value="Receive对象", description="收货")
public class Receive extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "收货单号")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "来源单号")
    @TableField("source_code")
    @Length(max = 100, message = "来源单号长度不能大于100", groups = {Save.class, Update.class})
    private String sourceCode;

    @ApiModelProperty(value = "仓库")
    @TableField("warehouse_code")
    private String warehouseCode;

    @ApiModelProperty(value = "所属机构Code")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "入驻商")
    @TableField("shipment_code")
    private String shipmentCode;

    @ApiModelProperty(value = "入驻商")
    @TableField("shipment_name")
    private String shipmentName;

    @ApiModelProperty(value = "单据类型；0：销售单；1：退货单；")
    @TableField("type")
    private String type;

    @ApiModelProperty(value = "下发状态:0未下发，1已下发；")
    @TableField("is_issue")
    private Integer issue;

    @ApiModelProperty(value = "供应商")
    @TableField("supplier_code")
    private String supplierCode;

    @ApiModelProperty(value = "客户")
    @TableField("customer_code")
    private String customerCode;

    @ApiModelProperty(value = "计划到货日期")
    @TableField("gmt_plan_arrival")
    private LocalDate gmtPlanArrival;

    @ApiModelProperty(value = "计划总数量（收货单位）")
    @TableField("total_quantity")
    private BigDecimal totalQuantity;

    @ApiModelProperty(value = "收货数量（收货单位）")
    @TableField("received_quantity")
    private BigDecimal receivedQuantity;

    @ApiModelProperty(value = "上架数量（收货单位）")
    @TableField("putaway_quantity")
    private BigDecimal putawayQuantity;

    @ApiModelProperty(value = "入库数量（收货单位）")
    @TableField("inbound_quantity")
    private BigDecimal inboundQuantity;

    @ApiModelProperty(value = "退货总数量（收货单位）")
    @TableField("refund_quantity")
    private BigDecimal refundQuantity;

    @ApiModelProperty(value = "退货总数量（基本单位）")
    @TableField("refund_basic_quantity")
    private BigDecimal refundBasicQuantity;

    @ApiModelProperty(value = "状态；0:新增；1：作废；2：待收货；3：部分收货；4：收货完成；")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "奇门三方平台ID")
    @TableField("customer_id")
    private String customerId;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 100, message = "备注长度不能大于100", groups = {Save.class, Update.class})
    private String remarks;

    @ApiModelProperty(value = "收货单明细")
    @TableField(exist = false)
    @Valid
    private List<ReceiveItem> receiveItemList = new ArrayList<>();

    @ApiModelProperty(value = "是否oms下发的；0：否；1：是；用于后期判断反填oms数据")
    @TableField("is_oms_order")
    private Integer isOmsOrder;


    @ApiModelProperty(value = "奇门入库单号")
    @TableField("entry_order_code")
    private String entryOrderCode;

    @ApiModelProperty(value = "单据类型，只做展示用，具体影响业务流程的还得看type，前端新建单据时，用documentType隐藏了type")
    @TableField("document_type")
    private String documentType;

    @ApiModelProperty(value = "原出库单号(ERP分配)")
    @TableField("pre_delivery_order_code")
    private String preDeliveryOrderCode;

    @ApiModelProperty(value = "运单号")
    @TableField("waybill_code")
    private String waybillCode;

    public interface Save {

    }

    public interface Update {

    }
}
